package com.bubbles.workspace.sync.repository.source.metadata;


import com.bubbles.engine.data.core.repository.BaseRepository;
import com.bubbles.workspace.sync.entity.source.metadata.SourceTable;
import com.bubbles.workspace.sync.key.source.metadata.SourceTableKey;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>description: 源数据源-表 </p>
 *
 * @author CryptoNeedle
 * @date 2025-06-20
 */
@Repository
public interface SourceTableRepository extends BaseRepository<SourceTable, SourceTableKey> {
    
    @Query("FROM SourceTable WHERE sourceTableEnabled = TRUE")
    List<SourceTable> listEnabled();
    
    @Query("FROM SourceTable WHERE sourceCatalogName = :sourceCatalogName AND sourceDatabaseName = :sourceDatabaseName")
    List<SourceTable> listByDatabase(String sourceCatalogName, String sourceDatabaseName);
}